import os
from tqdm import tqdm
# 源图片文件夹
source_dir = '/files/data/view_of_delft_PUBLIC/__delft/camera/camera75'


new_dirs = ['/files/data/view_of_delft_PUBLIC/temp0/camera/camera75',
            '/files/data/view_of_delft_PUBLIC/temp1/camera/camera75',
            '/files/data/view_of_delft_PUBLIC/temp2/camera/camera75',
            '/files/data/view_of_delft_PUBLIC/temp3/camera/camera75',
            '/files/data/view_of_delft_PUBLIC/temp4/camera/camera75',
            '/files/data/view_of_delft_PUBLIC/temp5/camera/camera75',
            '/files/data/view_of_delft_PUBLIC/temp6/camera/camera75']

# 获取所有图片文件（这里假设所有图片都是jpg，你可以根据需要修改扩展名）
images = [f for f in os.listdir(source_dir) if f.endswith('.jpg')]
images = sorted(images)
# 计算每个文件夹应该有多少图片（注意：这里不处理余数，余数将被添加到最后一个文件夹）
num_images = len(images)

# 分配图片到各个文件夹
for i, img in enumerate(tqdm(images)):
    # 原始图片和目标软连接的路径
    original_path = os.path.join(source_dir, img)
    link_path = os.path.join(new_dirs[i//1000], img)
    # 创建软连接
    os.symlink(original_path, link_path)

print('Finished creating symlinks.')